local banlushachu = fk.CreateSkill{
  name = "lingling__banlushachu",
}

Fk:loadTranslationTable{
  ["lingling__banlushachu"] = "半路杀出",
  [":lingling__banlushachu"] = "每回合限一次，当你攻击范围内的其他角色使用【闪】时，你可以对其使用【杀】。",

  ["#lingling__banlushachu-slash"] = "半路杀出：你可以对 %dest 使用一张【杀】",
}

banlushachu:addEffect(fk.CardUsing, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(banlushachu.name) and
      data.card.trueName == "jink" and player:inMyAttackRange(target) and
      player:canUseTo(Fk:cloneCard("slash"), target, { bypass_distances = true, bypass_times = true }) and
      player:usedSkillTimes(banlushachu.name, Player.HistoryTurn) == 0
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local use = room:askToUseCard(player, {
      skill_name = banlushachu.name,
      pattern = "slash",
      prompt = "#lingling__banlushachu-slash::" .. target.id,
      cancelable = true,
      extra_data = {
        exclusive_targets = {target.id},
        bypass_distances = true,
        bypass_times = true,
      }
    })
    if use then
      use.extraUse = true
      event:setCostData(self, {extra_data = use})
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    player.room:useCard(event:getCostData(self).extra_data)
  end,
})

return banlushachu
